package com.tronsis.distribution.activity.me.order;

import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.view.ViewPager;

import com.flyco.tablayout.SlidingTabLayout;
import com.tronsis.distribution.R;
import com.tronsis.distribution.fragment.deliver.DeliverFragment;
import com.tronsis.distribution.util.StateUtil;
import com.tronsis.library.activity.ToolBarBaseActivity;
import com.tronsis.library.adapter.SimpleViewPagerAdapter;

import java.util.ArrayList;
import java.util.List;

import butterknife.BindView;

/**
 * 我的发货
 */
public class MyDeliverActivity extends ToolBarBaseActivity {
    @BindView(R.id.tab_layout)
    SlidingTabLayout mTabLayout;
    @BindView(R.id.viewpager)
    ViewPager mViewPager;

    private List<Fragment> mPageList = new ArrayList<Fragment>();

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_my_deliver);
        setTitle(true, getString(R.string.my_delivery));

        Fragment deliverWaitFragment =  DeliverFragment.create(StateUtil.MY_DELIVER_DELIVERY);
        Fragment deliverFragment =  DeliverFragment.create(StateUtil.MY_DELIVER_DELIVERED);

        mPageList.add(deliverWaitFragment);
        mPageList.add(deliverFragment);



        SimpleViewPagerAdapter adapter = new SimpleViewPagerAdapter(getSupportFragmentManager(), mPageList);
        mViewPager.setAdapter(adapter);

        String[] mTitles = {"待发货", "已发货"};
        mTabLayout.setViewPager(mViewPager, mTitles);

    }
}
